/* 
  管理网络请求接口，所有网络请求都已通过方法封装好
*/
import request from "./request";
import qs from "qs";

// http://localhost:8080
// 获取精品推荐
export const getProductRec = () => request.get("/cms/products/recommend");

// 获取热门兑换
export const getProductHot = () => request.get("/cms/products/hot");

// 获取用户信息
export const getUserProfiles = () => request.get("/cms/shop/userProfiles");

// 查看购物车
export const getShopCarts = () => request.get("/cms/shop/carts");

//获取手机验证码
export const sendSMS = data => request.post("/cms/sendSMS", qs.stringify(data));

// 校验手机验证码
export const phoneRegin = data =>
  request.post("/cms/phoneRegin", qs.stringify(data));

// 微信扫码登录
export const wechatPCLogin = data =>
  request.post("/cms/wechatUsers/PCLogin", qs.stringify(data));

// 商品详情
export const getProductDetail = id => request.get("cms/products/" + id);

// 加入购物车
export const addCart = data =>
  request.post("/cms/shop/carts/add", qs.stringify(data));

// 查看购物车
export const getCart = () => request.get("cms/shop/carts");

// 删除购物车商品
export const DeleteCartProduct = data =>
  request.delete("cms/shop/carts", { params: data });

// 解绑微信
export const logoutWechat = () =>
  request.put("cms/wechatUsers/unbindingWeChat");
